import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const MicroWeatherStationMeta: IPublicTypeComponentMetadata = {
  componentName: 'MicroWeatherStation',
  title: '微型气象站',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'MicroWeatherStation',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'iconPath',
      propType: 'string',
      description: '图标路径'
    },
    {
      name: 'title',
      propType: 'string',
      description: '标题文字'
    },
    {
      name: 'titleColor',
      propType: 'string',
      description: '标题文字颜色'
    },
    {
      name: 'titleFontSize',
      propType: 'number',
      description: '标题字体大小'
    },
    {
      name: 'titleFontWeight',
      propType: 'string',
      description: '标题字体粗细'
    },
    {
      name: 'titleLetterSpacing',
      propType: 'string',
      description: '标题字间距'
    },
    {
      name: 'titleLineHeight',
      propType: 'string',
      description: '标题行高'
    },
    {
      name: 'titleAlign',
      propType: 'string',
      description: '标题对齐方式'
    },
    {
      name: 'showIcon',
      propType: 'bool',
      description: '显示图标'
    },
    {
      name: 'iconOpacity',
      propType: 'number',
      description: '图标透明度'
    },
    {
      name: 'spacing',
      propType: 'number',
      description: '图标和文字间距'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onIconClick',
      propType: 'func',
      description: '图标点击事件'
    },
    {
      name: 'onTitleClick',
      propType: 'func',
      description: '标题点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'title',
        title: { label: { type: 'i18n', 'en-US': 'title', 'zh-CN': '标题文字' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '微型气象站' }
      },
      {
        name: 'iconPath',
        title: { label: { type: 'i18n', 'en-US': 'iconPath', 'zh-CN': '图标路径' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/qixiangfangzhai/bz64.png' }
      },
      {
        name: 'titleColor',
        title: { label: { type: 'i18n', 'en-US': 'titleColor', 'zh-CN': '标题文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'titleFontSize',
        title: { label: { type: 'i18n', 'en-US': 'titleFontSize', 'zh-CN': '标题字体大小' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 20 }
      },
      {
        name: 'titleLetterSpacing',
        title: { label: { type: 'i18n', 'en-US': 'titleLetterSpacing', 'zh-CN': '标题字间距' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '2px' }
      },
      {
        name: 'showIcon',
        title: { label: { type: 'i18n', 'en-US': 'showIcon', 'zh-CN': '显示图标' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      },
      {
        name: 'iconOpacity',
        title: { label: { type: 'i18n', 'en-US': 'iconOpacity', 'zh-CN': '图标透明度' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 1 }
      },
      {
        name: 'spacing',
        title: { label: { type: 'i18n', 'en-US': 'spacing', 'zh-CN': '图标和文字间距' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 4 }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '微型气象站',
    screenshot: '',
    schema: {
      componentName: 'MicroWeatherStation',
      props: {
        width: 175,
        height: 62,
        iconPath: 'http://localhost:8085/static/images/qixiangfangzhai/bz64.png',
        iconSize: {
          width: 32,
          height: 32
        },
        title: '微型气象站',
        titleColor: '#FFFFFF',
        titleFontSize: 20,
        titleFontWeight: 400,
        titleLetterSpacing: '2px',
        titleLineHeight: '29px',
        titleAlign: 'left',
        showIcon: true,
        iconOpacity: 1,
        spacing: 4,
        theme: 'dark'
      }
    }
  }
];

export default {
  ...MicroWeatherStationMeta,
  snippets
};
